-module(tr_listener_sup).
-behaviour(supervisor).

-export([start_link/0, 
         start_child/1]).

-export([init/1]).

-define(CHILD(Id, Mod, Type, Args), {Id, {Mod, start_link, Args},
                                     permanent, 5000, Type, [Mod]}).

start_link() ->
    supervisor:start_link({local, ?MODULE}, ?MODULE, []).

start_child(Socket) ->
    supervisor:start_child(?MODULE, 
                           {tr_acceptor,
                            {tr_acceptor, start_link, [Socket]},
                            temporary, brutal_kill, worker, []}).

init([]) ->
    {ok, {{one_for_one, 5, 10}, 
          [?CHILD(tr_listener, tr_listener, worker, [1055])]}}.
